-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: security 관련 Bean 추가 구현 #13
Conversation
Test Results7 tests ±0 6 ✅ - 1 1s ⏱️ ±0s Results for commit e7e12db. ± Comparison against base commit 6a5678d. This pull request removes 1 and adds 1 tests. Note that renamed tests count towards both.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws | ||
ServletException, | ||
IOException { | ||
try { | ||
filterChain.doFilter(request, response); | ||
} catch (CakkException exception) { | ||
setErrorResponse(exception.getReturnCode(), response); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JwtExceptionFilter에 대해서는 Interceptor에서 하지 않고 Filter에서 처리하는 이유가 Spring Security에서 필터를 활용하기 때문인가요~?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
네, 맞습니다. Security 설정 시, 필터의 순서를 결정할 수 있습니다. 이 필터들이 doFilter 메서드를 통해 다음 필터로 넘기고 마지막에 디스패처 서블릿으로 요청을 위임하는데, 필터에서 예외처리를 하지 않으면 서버 에러가 그대로 내려오게 됩니다. 그래서 ExceptionFilter를 인증 필터 뒤에 설정한거구요.
인터셉터는 디스패쳐 서블릿에서 받는 요청과 응답에 대해 컨트롤하는, 스프링 컨테이너와 관련된 기술이므로, 필터가 맞다고 판단했습니다.
#4